JBoss Community Archive (Read Only)

Teiid 8.10

Programmatic Control

Teiid exposes a bean that implements the org.teiid.events.EventDistributor interface. It can be looked up in JNDI under the name teiid/event-distributor-factory. The EventDistributor exposes methods like dataModification (which affects result set caching) or updateMatViewRow (which affects internal materialization) to alert the Teiid engine that the underlying source data has been modified. These operations, which work cluster wide will invalidate the cache entries appropriately and reload the new cache contents.

Change Data Capture

If your source system has any built-in change data capture facilities that can scrape logs, install triggers, etc. to capture data change events, they can captured and can be propagated to Teiid engine through a pojo bean/MDB/Session Bean deployed in JBoss AS engine.

The below shows a code example as how user can use EventDistributor interface in their own code that is deployed in the same JBoss AS VM using a Pojo/MDB/Session Bean. Consult JBoss AS documents deploying as bean as they out of scope for this document.

EventDistributor Code Example
public class ChanageDataCapture {

    public void invalidate() {
        InitialContext ic = new InitialContext();
        EventDistributor ed = ((EventDistributorFactory)ic.lookup("teiid/event-distributor-factory")).getEventDistributor();

        // this below line indicates that Customer table in the "model-name" schema has been changed.
        // this result in cache reload.
        ed.dataModification("vdb-name", "version", "model-name", "Customer");
    }
}
Updating Costing information

The EventDistributor interface also exposes many methods that can be used to update the costing information on your source models for optimized query planning. Note that these values volatile and will be lost during a cluster re-start, as there is no repository to persist.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 12:13:35 UTC, last content change 2013-09-23 13:36:17 UTC.